using Godot;

[GlobalClass]
public partial class CRemoteSkill : CSkill
{
    public override void doHurt(NCharacter cha)
    {
        NCharacter enemy = cha.GetNodeOrNull<NCharacter>(cha.mData.mSkillTarget.mTargetPath);
        if (enemy != null && !enemy.IsDead)
        {
            NRemoteHurt rh = CHelp.insScene("res://scene/skill/远程攻击/NRemoteHurt.tscn") as NRemoteHurt;
            //角色路径
            rh.mSelfChaPath = cha.GetPath().ToString();
            //敌人路径
            rh.mRemoteChaPath = enemy.GetPath().ToString();

            enemy.AddChild(rh);
            //初始位置为玩家位置
            rh.GlobalPosition = cha.GlobalPosition;
        }
    }
}